<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
    <title>捐书审核</title>
    <link rel="stylesheet" type="text/css" href="../static/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="../static/css/donate_list.css"/>
    <link rel="stylesheet" type="text/css" href="../static/css/weui.min.css"/>
</head>
<body ontouchstart>
<div class="top_title">
    <div onclick="history.back()"><img class="back" src="../static/img/back_btn.png"/><span>返回</span></div>
    <div><span>捐书审核</span>&nbsp;&nbsp;&nbsp;&nbsp;</div>
    <div><img class="other" src="../static/img/other_btn.png"/></div>
</div>
<div class="top_place"></div>
<div class="empty_content" style="display: none">
    <div class="img">
        <img src="../static/img/none.png" width="186px" height="158px">
        <p>您没有需要审核的订单！</p>
    </div>
</div>
<div class="content">
    <div id="donate_list">
    </div>
</div>
</body>
<script type="text/javascript" src="../../static/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../static/js/weui.min.js"></script>
<script type="text/javascript" src="../../static/js/core/underscore.js"></script>
<script type="text/javascript" src="../../static/js/core/util.js"></script>
<script type="text/javascript" src="../../static/js/core/ocean.js"></script>
<script>
    Window.onload = Load();

    function Load() {
        ShowDonateList();
    }

    function ShowDonateList() {
        var params = {
            page: 1,
            limit: 10
        };


        ocean.get("resources/biz/bc/api/verify/order", params, function (data) {
            if (data.code === 0) {
                var content = data.data.list;
                console.log(content);
                if (content.length === 0) {
                    $(".empty_content").show();
                    $(".content").hide();
                } else {
                    $(".empty_content").hide();
                    $(".content").show();
                    var donate = _.template($('#donate_item').html());
                    $("#donate_list").append(donate({items: content}));
                }
            }
            $(".book_box").click(function () {
                var id = $(this).data("id");
                location.href = "verify_detail.html?id=" + id;
            })
        }, function (error) {
            ocean.tip(error);
        });
    }
</script>
<script id="donate_item" type="text/template">
    <@_.each(items, function (item) {@>
    <div class="book_box" data-id="<@=item.id@>">
        <div class="order_info">
            <span class="order_number">订单号：<@=item.orderNo@></span>
            <@if (item.state === "CREATED") {@>
            <span class="order_state">待审核</span>
            <@} else if (item.state === "FINISHED") {@>
            <span class="order_state">已完成</span>
            <@}@>
        </div>
        <div class="book_info">
            <div class="img" style="background-image: url(<@=item.picture.split('@')[0]@>)"></div>
            <div class="text">
                <p class="number">共<@=item.totalNum@>本</p>
                <p class="integral"><@=item.grade@>熊猫币</p>
            </div>
        </div>
    </div>
    <@ }); @>
</script>
</html>
